var file_id = $.query.get('file_id');
var target_id= $.query.get('target_id');
var edidImageOptions={
		page_id:67,
		grid_id:"editImageGrid",
		isToolbar:"no",//没有搜索框
		sqlname:"grid_sys_pub_file_item",//grid_sys_pub_file_item_target_rel
		gridParam:{target_id:target_id,file_id:file_id}
};
grid2=new uniontrip.datagrid.searchEdit(edidImageOptions);
//document ready
$(function(){
	
	$('#removeImageButton').bind('click', grid2.remove);
	$('#saveButton').bind('click', grid2.accept);//保存datagrid绑定事件
	$('#rejectButton').bind('click', grid2.rejectChanges);//撤销编辑绑定事件
});

/**
 * 删除图片
 */
function onRemoveImage(){
	gridConfirm(grid2.grid,"是否确认删除图片",removeImage);
}
/**
 * 执行删除
 * @param row
 */
function removeImage(row){
	$._post("/authenticated/upload/deleterel",JSON.stringify({'id':row.id}),function(result){
		if(result.success){
			$.messager.alert("提示", "删除成功！");
			grid2.grid.datagrid("load");
			//$("#iphonef").attr("src","http://lvzhi.com/50/preview/"+id+"?t="+Math.random());
		}else{
			$.messager.alert("提示", "删除失败！<br>"+result.message);
		}
	});
}